//============================================================================
// Name        : Registry.cpp
// Author      : lucmir@dcc.ufmg.br
// Description :
//============================================================================

#include "Registry.h"


Registry::Registry(unsigned int termId, unsigned int docId, unsigned int freq)
	: termId(termId),
	  docId(docId),
	  freq(freq) {
}

Registry::~Registry() {
}

unsigned int Registry::getDocId() const {
	return docId;
}

unsigned int Registry::getFreq() const {
	return freq;
}

unsigned int Registry::getTermId() const {
	return termId;
}

void Registry::setDocId(unsigned int docId) {
	this->docId = docId;
}

void Registry::setFreq(unsigned int freq) {
	this->freq = freq;
}

void Registry::setTermId(unsigned int termId) {
	this->termId = termId;
}

void Registry::print() {
	std::cout << "[" << this->termId << "," << this->docId << "," << this->freq << "]" << std::endl;
}

bool Registry::operator<(const Registry &r) const {
	if(this->getTermId() != r.getTermId()) {
		return (this->getTermId() < r.getTermId());
	}
	else if (this->getDocId() != r.getDocId()) {
		return (this->getDocId() < r.getDocId());
	}
	return (this->getFreq() < r.getFreq());
}

bool Registry::operator>(const Registry &r) const {
	return !(*this < r);
}

